{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block keywords %}{{ setting('site.seo_keywords') }}{% endblock %}
{% block description %}{{ setting('site.seo_description') }}{% endblock %}

{% set siteNav = "/" %}
{% set bodyClass = 'homepage' %}
{% set script_controller = 'index' %}

{% block full_content %}
  
  <!-- 轮播 -->
  {{ block_show('jianmo:home_top_banner') }}

  <!-- 统计信息 -->
  <section class="web-tongji-section" id="web-tongji">
    <div class="container">
       <div class="web-tongji-header">
          <div class="text-line gray">
            <h5>
				<span>{% if app.user %}我们的库课{% else %}注册库课{% endif %}</span>
				<div class="line"></div>
			</h5>
          </div>
        </div>
        <div class="web-tongji-content row">
            <div class="col-md-3">
              {{ render(controller('CustomWebBundle:Default:statisticsa')) }}
            </div>
            <div class="col-md-6">
              {{ render(controller('CustomWebBundle:Default:statisticsb')) }}
            </div>
            <div class="col-md-3 col-sm-12" >
               <div class="join-btn">
                 {% if app.user %}
                    <a href="{{ path('my') }}">学习中心</a>
                 {% else %}
                   <a href="{{ path('register', {goto:_target_path|default(app.request.server.get('REQUEST_URI'))}) }}">我要加入</a>
                 {% endif %}
               </div> 
            </div>
        </div>
    </div>
  </section>
  
  
  
  <!-- 课程列表 -->
  <section class="course-list-section" id="course-list">
    {% include 'TopxiaWebBundle:Default:course-grid-with-condition.html.twig' %}
  </section>
  {% set RecentLiveCourses = data('RecentLiveCourses',{ 'count':4}) %}
  {% if RecentLiveCourses %}
  <section class="live-course-section">
    <div class="container">
      <div class="text-line gray">
        <h5><span>近期直播</span><div class="line"></div></h5>
        <!-- <div class="subtitle">实时跟踪直播课程，避免课程遗漏。</div> -->
      </div>
      <div class="course-list">
        <div class="row">
          {% for course in RecentLiveCourses %}
            <div class="col-lg-3 col-md-4 col-sm-6">
              {% include 'TopxiaWebBundle:Course:Widget/course-grid.html.twig' with {course:course} %}

              {% set lesson = course['lesson']|default(null) %}
              {% if lesson and "now"|date("U") >= lesson.startTime and "now"|date("U") <= lesson.endTime %}
                <div class="course-date visible-lg">
                  <div class="btn-circle btn-live  btn-circle-md">
                    <i class="es-icon es-icon-videocam"></i>
                  </div>
                  <div class="date">
                    正在直播
                  </div>
                </div>
              {% else %}
                <div class="course-date visible-lg">
                  <div class="btn-circle btn-circle-md">
                    <i class="es-icon es-icon-videocam"></i>
                  </div>
                  <div class="date">
                    {{ lesson.startTime|date('n月j日 H:i') }}
                  </div>
                </div>
              {% endif %}

            </div>
          {% endfor %}

          {% set emptyCourseNum = 4 - RecentLiveCourses|length %}
          {% if emptyCourseNum > 0 %}
            {% for i in range(1, emptyCourseNum) %}
              <div class="col-lg-3 col-md-4 col-sm-6 visible-lg">
                <div class="course-item course-default">
                  <i class="es-icon es-icon-videocam"></i>
                  <br>
                  敬请期待
                </div>
                <div class="course-date">
                  <div class="btn-circle btn-circle-md">
                    <i class="es-icon es-icon-accesstime"></i>
                  </div>
                </div> 
              </div>
            {% endfor %}
          {% endif %}
        </div>
      </div>
      <div class="text-center mvl">
        <a href="{{ path('live_course_explore') }}" class="btn btn-default btn-lg">
          更多直播 <i class="mrs-o es-icon es-icon-chevronright"></i>
        </a>
      </div>
    </div>
  </section>
  {% endif %}

  <!-- 特性 -->
  {{ block_show('jianmo:middle_banner') }}


  <!-- 推荐班级 -->
  {% set RecommendClassrooms = data('RecommendClassrooms',{'count':12})%}
  {% if RecommendClassrooms %}
    <section class="class-section" id = "classroom">
      <div class="container">
        <div class="text-line">
          <h5>
            <span>推荐{{ setting('classroom.name')|default("班级") }}</span>
            <div class="line"></div>
          </h5>
          <!-- <div class="subtitle">班级化学习体系，给你更多的课程相关服务。</div> -->
        </div>
        <div class="recommend-class-list row">
          {% for classroom in RecommendClassrooms %}
            <div class="col-md-3 col-sm-6">
               {% include 'ClassroomBundle:Classroom:class-grid.html.twig' %} 
            </div>
          {% endfor %}
        </div>
        <div class="text-center mvl">
          <a href="{{ path('classroom_explore') }}" class="btn btn-default btn-lg">
            更多{{ setting('classroom.name')|default("班级") }} <i class="mrs-o es-icon es-icon-chevronright"></i>
          </a>
        </div>
      </div>
    </section>
  {% endif %}
  
  <!-- 考场列表 -->
  <section class="course-list-section" id="kaochang-list">
    {% include 'TopxiaWebBundle:Default:kaochang-grid-with-condition.html.twig' %}
  </section>
  
  <!-- 学霸排行 -->
  <section class="recommend-students" id= "paihang">
    <div class="container">
      <div class="recommend-students-header">
        <div class="text-line">
          <h5><span>学霸排行榜</span></h5>
            <div class="line"></div>
          </div>
        </div>
        <div class="row">
          {{ render(controller('CustomWebBundle:Default:MemberRankByUserCourses',{count:18})) }}
        </div>
    </div>
  </section>

  <!-- 小组动态 -->
  {% set groups = data('HotGroup',{'count':6}) %}
  {% if groups %}
    <section class="group-dynamic" id="group">
      <div class="container">
        <div class="text-line gray">
          <h5><span>小组动态</span><div class="line"></div></h5>
          <!-- <div class="subtitle">参与小组，结交更多同学，关注课程动态。</div> -->
        </div>
        <div class="group-dynamic-body row">
          <div class="col-md-6">
            <div class="panel panel-default index-group">
              <div class="panel-heading">
                <a href="{{ path('group') }}" class="more"><i class="es-icon es-icon-morehoriz"></i></a>
                <h3 class="panel-title"><i class="es-icon es-icon-whatshot pull-left"></i>热门小组</h3>
              </div>
              <div class="panel-body row">
                {% for group in groups %}
                  <div class="media media-group col-md-6 col-sm-4">
                    <div class="media-left">
                      <a href="{{ path('group_show',{id:group.id}) }}">
                        {% if group.logo %}
                          <img class="avatar-square-md" src="{{file_path(group.logo)}}" alt="{{ group.title }}">
                        {% else %}
                          <img class="avatar-square-md" src="{{asset('assets/img/default/group.png')}}"  alt="{{ group.title }}">
                        {% endif %}
                      </a>
                    </div>
                    <div class="media-body">
                      <div class="title">
                        <a class="link-light" href="{{ path('group_show',{id:group.id}) }}">
                          {{ group.title }}
                        </a>
                      </div>
                      <div class="metas">
                        <span><i class="es-icon es-icon-people"></i>{{ group.memberNum }}</span>
                        <span><i class="es-icon es-icon-textsms"></i>{{ group.threadNum }}</span>
                      </div>
                    </div>
                  </div>
                {% endfor %}
              </div>
            </div>
          </div>
          <div class="col-md-6">
            <div class="panel panel-default index-dynamic">
              <div class="panel-heading">
                <h3 class="panel-title">
                  <i class="es-icon es-icon-recentactors pull-left"></i>学员动态
                </h3>
              </div>
              <div class="panel-body">
                {% set statuses = data('LatestStatuses', {mode:'simple', count: 4,private:0}) %}

                {% for status in statuses %}
                  <div class="media media-dynamic">
                    <div class="media-left">
                      {{ web_macro.user_avatar(status.user, '', 'avatar-sm') }}
                    </div>
                    <div class="media-body">
                      <div class="title">
                        {{ web_macro.user_link(status.user) }}
                      </div>
                      <div class="content">
                        {{ status.message|raw }}
                      </div>
                      <span class="date">{{status.createdTime | smart_time}}</span>
                    </div>
                  </div>
                {% endfor %}
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  {% endif %}

  <!-- 推荐教师 -->
  {% set teachers = data('RecommendTeachers',{'count':12}) %}
  {% if teachers %}
  <section class="recommend-teacher" id="tuijian">
    <div class="container">
      <div class="text-line">
        <h5><span>推荐教师</span><div class="line"></div></h5>
        <!-- <div class="subtitle">名师汇集，保证教学质量与学习效果。</div> -->
      </div>
      <div class="row">
        {% for teacher in teachers %}
        {% set profile = teacher.profile %}
        {% set isFollowed = teacher.isFollowed %}
          <div class="col-md-3 col-sm-6 addxinstyle">
            {% include 'TopxiaWebBundle:Teacher:teacher-item.html.twig' %}
          </div>
        {% endfor %}
      </div>
      <div class="text-center mvl">
        <a href="{{ path('teacher') }}" class="btn btn-default btn-lg">
          更多教师 <i class="mrs-o es-icon es-icon-chevronright"></i>
        </a>
      </div>
    </div>
  </section>
  {% endif %}

<link href="/assets/css/fixed/css.css" rel="stylesheet" type="text/css">
<div class="gd_box" style="top: 100px; position: fixed; z-index: 9999;display:none;">
	<div id="gd_box">
		<div id="gd_box1">
			<div id="navtwo" style="background-color:#947D7B;">
				<ul>
					<li class="current" style="line-height: 44px;">
						<a class="f1" href="#course-list"><img src="assets/img/fixed/557257ac64053.png">
							<div class="scroll_1">网校</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a class="f2" href="#classroom"><img src="assets/img/fixed/557257c279cae.png">
							<div class="scroll_2">班级</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a class="f3" href="#kaochang-list" ><img src="assets/img/fixed/557257d0895f5.png">
							<div class="scroll_3">题库</div>
						</a>
					</li>
					<li class="">
						<a class="f4" href="#paihang" ><img src="assets/img/fixed/5572b01daa4d9.png">
							<div class="scroll_4">排行</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a class="f5" href="#group"><img src="assets/img/fixed/557257e13a0fd.png">
							<div class="scroll_5">小组</div>
						</a>
					</li>
					<li>
						<a class="f6" href="#tuijian"><img src="assets/img/fixed/557257ef96168.png">
							<div class="scroll_6">推荐</div>
						</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
</div>

<div class="gd_box" style="top: 100px; position: fixed; z-index:999">
	<div id="gd_box">
		<div id="gd_box1">
			<div id="navtwo">
				<ul>
					<li style="line-height: 44px;">
						<a href="#course-list" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#6bd976; font-size:12px; font-weight:bold;" class="f1">
							<div class="scroll_1">网校</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a href="#classroom" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#ffa660;font-size:12px; font-weight:bold;" class="f2" >
							<div class="scroll_2">班级</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a href="#kaochang-list" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#ff7361; font-size:12px; font-weight:bold;line-height:45px;" class="f3" >
							<div class="scroll_3">题库</div>
						</a>
					</li>
					<li class="">
						<a href="#paihang" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#efd157; font-size:12px; font-weight:bold; line-height:45px;" class="f4" >
							<div class="scroll_4">排行</div>
						</a>
					</li>
					<li class="" style="line-height: 44px;">
						<a href="#group" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#66aee8; font-size:12px; font-weight:bold;line-height:45px;" class="f5">
							<div class="scroll_5">小组</div>
						</a>
					</li>
					<li>
						<a href="#tuijian" style="display: block; position:absolute; top:0; right:0; color:#fff;width:45px;height:45px; background:#73e1b0; font-size:12px; font-weight:bold;line-height:45px;" class="f6">
							<div class="scroll_6">推荐</div>
						</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
</div>

{% endblock %}